package com.library.dao.impl;

import com.library.dao.IAdminDao;
import com.library.entity.Admin;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by linzhi on 2016/12/15.
 */
@Repository
public class AdminDao extends BaseDao<Admin> implements IAdminDao {
    @Override
    public Admin findByUsername(String username) {
        String hql="from Admin a where a.username=?";
        List<Admin> result = this.find(hql, new Object[]{username});
        if (result!=null&&result.size()>0) {
            return result.get(0);
        }
        return null;
    }
}
